import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
import log from './utils/console'
// 分页组件
import Pagination from '@/components/Pagination'
import '@/icons' // icon
import '@/permission'
import plugins from '@/plugins'
import { resetForm } from '@/utils/tools' // 封装插件全局引用

if (process.env.NODE_ENV === 'production') {
  const { mockXHR } = require('../mock')
  mockXHR()
}

// 全局组件挂载
Vue.component('Pagination', Pagination)

// 设置 ElementUI 为中文
Vue.use(ElementUI, { locale })
Vue.config.productionTip = false

Vue.use(plugins)

// 方法全局挂载
Vue.prototype.log = log
Vue.prototype.resetForm = resetForm

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
